home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 176-200 / scopedisk189 / dr-13 / dr.doc < prev    next >
Text File  |  1995-03-19  |  25KB  |  461 lines

  1.  
  2.                                     DR         (release 1.3)
  3.  
  4. What we got here is Yet Another CLI Directory Listing Command, called Dr
  5. (pronounced "dr") because it leaves out icons.  (Like, the missing I in Dir
  6. stands for icon...?  never mind.)  It is a fast and full featured program
  7. which is superior to all of the ten other Amiga directory listers I've
  8. tried.  I couldn't live without it.  Even its half-finished versions were
  9. preferable to Dir.  The features it offers are:
  10.  
  11.   + By default, .info files are not mentioned in the output.  Instead, it
  12.     shows you which files have xxxxx.info files associated with them by
  13.     writing their names in orange (or whatever you have set color 3 to be).
  14.     Any xxxxx.info file that is not associated with a regular file or
  15.     directory is shown normally, e.g. Disk.info.  You can see all .info files
  16.     normally with the -I option.
  17.  
  18.   + It is fully reentrant and reexecutable.  The "pure" bit is set.
  19.  
  20.   + It is about as fast as a directory listing program can possibly be on the
  21.     Amiga.  (Which is still slow.)  With well-filled floppies, Dr is
  22.     frequently three times as fast as Dir ...other "fast" listers usually get
  23.     about half that much improvement, and are usually less reliable besides.
  24.     Under the Fast File System, there is much less difference, but Dr still
  25.     has a slight edge.  The guy who wrote NewList 4.5 claimed it was faster
  26.     than Dr ... and it WAS faster than Dr 1.2 in this one case (scanning one
  27.     FFS directory without recursive descent).  But it is slower than Dr 1.3!
  28.  
  29.   + When recursively showing contents of subdirectories with the -R option,
  30.     Dr's speed advantage increases further.  Even with the Fast File System
  31.     25% to 75% speed improvement is common.  Apparently, the more fragmented
  32.     your disk is, the bigger the difference.
  33.  
  34.   + New in release 1.3:  You can format the output so as to put the filenames
  35.     into some context (like List LFORMAT but better), for instance generating
  36.     an AmigaDOS command for each filename.  It can either write out this
  37.     formatted output, or execute it as a command, or do both with different
  38.     formats.
  39.  
  40.   + It arranges the output in a variable number of columns, with spacing
  41.     based on both the length of the longest filenames and the width of the
  42.     window.  It assumes a width of 77 when output is not going to a CON:
  43.     window.  By default, it sorts the entries in columns, not in rows; it's
  44.     easier to find things alphabetically that way (try it out if you don't
  45.     think so).  The -H option makes it sort in rows.
  46.  
  47.   + It handles AmigaDOS wildcard patterns, like #?.(c|o) to list all xxxxx.c
  48.     and xxxxx.o files.  And if an actual directory has a name with pattern
  49.     characters in it, like maybe a directory called "Doesn't-work?", it will
  50.     list that directory instead of expanding the pattern.  You can force it
  51.     to expand by adding an extra percent sign to the pattern, so it doesn't
  52.     match the name.  New in 1.3:  You can show all files that do NOT fit a
  53.     pattern by putting a ~ at the beginning of it, e.g. dr foo/~#?.o shows
  54.     all files in foo that do not end with .o; a ~ in the middle of a pattern
  55.     has no special meaning.
  56.  
  57.   + It can sort alphabetically (the default) or chronologically (newest
  58.     last) with the -C option.
  59.  
  60.   + It has an option (-O) to list each filename on a separate line as a
  61.     complete pathname.  This is useful for generating input to other
  62.     programs.  (The -F option is useful for this.)  Files are sorted by disk
  63.     address when you use this.  This makes the list more efficient for other
  64.     programs to process, sometimes.
  65.  
  66.   + It can list the size of each file in bytes with the -S option, or list
  67.     complete information about each file and directory (size, protection,
  68.     datestamp, filenote) like the List program with the -L option.  -L is
  69.     automatic if the argument you give it is the name of a single file
  70.     instead of a directory.  The -X option makes it give this information
  71.     about a directory instead of showing that directory's contents.
  72.  
  73.   + The -U option makes it like "du", showing only disk space consumption.
  74.     Typically you would combine it with -R.  Use "alias du Dr -ur []".
  75.  
  76.   + New in release 1.3: the -A and -B options let you select files and dirs
  77.     by age, and the -K option shows their disk addresses.  Since release 1.2:
  78.     the -P option makes it show only files and dirs that have a certain
  79.     protection bit set or clear.
  80.  
  81.   + It uses a significant amount of memory, but if that much isn't available,
  82.     it won't fail.  (Well hardly ever...)  It will simply work slower.  When
  83.     there's only a little extra room, it will work slightly faster than Dir.
  84.     Release 1.3 avoids hogging the last of the memory just to be faster.
  85.  
  86.   + And last but certainly not least, it's public domain and the source
  87.     code is provided.  This includes the fast directory scanning routines
  88.     FastExamine and FastExNext, which many programs may find useful since
  89.     they are almost compatible with regular Examine and ExNext.  See the file
  90.     FastExNext.doc.  CREDIT:  the pattern matching code is PatMatch by Jeff
  91.     Lydiatt, available on Fish disk 85, modified to be reentrant.
  92.  
  93. Directory names are listed before file names, separated with a line of
  94. dashes, unless one or the other came up empty.  Each directory name is
  95. followed by a slash.  Only the name itself, not the slash, is orange if it
  96. has an icon.  Things with associated .info files will be marked as such even
  97. if the .info file itself is excluded by the pattern, or by the -D or -A or -B
  98. options.  If you list just a single file, it will check whether it has a
  99. .info file, unless you use the -I option.  It does not check to see whether
  100. files with names ending in .info are actual valid icon files.
  101.  
  102. Note that if the output is not a CON window, it doesn't show you which files
  103. had icons.  It used to precede iconed names with a plus sign, but I concluded
  104. that this was not a win.  If you want to find icons when you're saving the
  105. output, you just gotta use the -I option.  Let me know if you want this
  106. changed.  I heard that the numerous .info files are gonna disappear in
  107. AmigaDOS 2.0 anyway.  That and FFS in ROM will eliminate most of my reasons
  108. for writing Dr in the first place.  Sigh.  So the 2.0 version of Dr might
  109. be two thirds the size of this one, but not really better than some other
  110. programs.  Damn, a lot of the work I did in 1989 is turning out to be wasted.
  111. It would have been less wasted of course if I had gotten this thing out the
  112. door a year earlier ...  "Dr:  the Video Toaster of directory listers."
  113.  
  114. Pattern wildcard characters are currently only recognized at the end of
  115. a pathname (that is, after the last slash or colon if any); you can't yet go
  116. "Dr #?/src/#?.c" to find all .c files in subdirectories named src.  This
  117. ability will be added someday.  If anybody cares.  And maybe I'll improve the
  118. pattern parser itself so that it is tolerant of mismatched parens and such.
  119. And maybe make it able to use ~ (negation) inside the pattern instead of just
  120. at the beginning.
  121.  
  122. USAGE:  type Dr followed by zero or more file names, directory names,
  123. patterns, or options.  The options in this version are:
  124.  
  125.     ?   Briefly explain all of the options.
  126.  
  127.     -I  List .info files like normal files instead of marking the other
  128.         files they are associated with.
  129.  
  130.     -S  Show the size of each file in bytes, and (new in release 1.2) totals.
  131.  
  132.     -C  Sort chronologically (newest last) instead of alphabetically.
  133.  
  134.     -H  Sort into rows instead of columns, if more than one column.
  135.  
  136.     -O  Put each filename on a separate line, as a complete pathname.  There
  137.         is no other extraneous output and no sorting.  Overrides -L, -S, -K,
  138.         and -C.  The beginning of the pathname is the directory arg you
  139.         specified, not the absolute path.  (The pathname has a maximum length
  140.         of 300 characters.)
  141.  
  142.     -D  Do not show file names, only subdirectory names.  Cancels -F.
  143.  
  144.     -F  Do not show subdirectory names, only file names.  Cancels -D.
  145.  
  146.     -L  Show sizes, protection bits, datestamps and filenotes like List.
  147.         Overrides -S.  Show total bytes/blocks used.
  148.  
  149.     -K  Show the disk address (block key) of each file or directory, in
  150.         square brackets.
  151.  
  152.     -X  Show directory args as if they were in a -L listing, instead of
  153.         scanning their contents.  Ignored if -R or a pattern is used. 
  154.         Overrides -F, -D, and -P.
  155.  
  156.     -R  Recursively show contents of all subdirectories.  If you're going to
  157.         descend a whole lot of levels (like more than about nine) you might
  158.         need a bigger stack than the default 4K.  It checks for adequate
  159.         stack before entering each subdirectory.  An 8K stack would let you
  160.         go about 40 levels deep.
  161.  
  162.     -U  Show only disk space consumed, and a count of files and directories,
  163.         without listing any names.  Overrides all other options except -R.
  164.  
  165.     -A# (example: -A30)  Show all files dated within the last # days.  The
  166.         cutoff point would be midnight before the day # days ago.  Thus -A0
  167.         would show today's files.  -A not followed by a digit cancels.
  168.  
  169.     -B# (example: -B5)  Like -A, but show all files more than # days old.
  170.         Combining -A with -B uses a range of days, or excludes a range of
  171.         days if the -A number is smaller (more recent) than the -B number.
  172.  
  173.     -P  A bit more complicated than the options above; the letter P may have
  174.         a tilde (~) after it, and immediately after that a letter, one of H,
  175.         S, P, A, R, W, E, or D (lowercase OK).  This letter represents a
  176.         protection bit.  If the tilde is between the P and the letter, Dr
  177.         will show only files for which that protection bit is not set.  If
  178.         there is no tilde it will show only those for which it is set.  For
  179.         instance, to show all "pure" files, use -PP.  To show all files which
  180.         have not been backed up, use -P~A.  Use -P with a space after it to
  181.         cancel earlier -P options, making it ignore protection bits.  For the
  182.         bits R, W, E, and D, "set" means that the bit shows as present when
  183.         you use List or Dr -L.  The bit is actually a zero on the disk in
  184.         this case.  So for example -PD means show deletable files, -P~D means
  185.         show files protected from deletion.  Oh yeah ... you can use a caret
  186.         (^) instead of a tilde (~) if you want.
  187.  
  188.     -[...format string...]
  189.         Control the format of the output.  For each file or directory to be
  190.         listed, the text inside the brackets is written out followed by a
  191.         newline.  Substitutions are made on that text as follows:
  192.            \n is replaced with a newline.
  193.            \d is replaced with the name of the directory being searched.
  194.            \f is replaced with the name of the current file or directory
  195.                being listed, with no path in front.
  196.            \/ is a slash unless the preceding character output was a slash,
  197.                colon, double-quote or whitespace (or control char).  For
  198.            joining filenames onto directory names.
  199.            \p is replaced with the full pathname of the current file or
  200.                directory.
  201.            \+ prevents newline at the end of each output.
  202.            \ before anything else "quotes" it.  Use \\ for \ and \] for ].
  203.         To cancel a previous format option, use -[].  Overrides -C, -S, -L,
  204.         -O, and -K.  Output is in disk block order as with -O.  Note that
  205.         whitespace and double-quotes inside -[...] are treated like any other
  206.         characters, not as marking separate arguments to Dr.  The output
  207.         after substitutions is limited to 255 characters.
  208.  
  209.     -{... format string...}
  210.         Like -[...], except it executes the result as a CLI command instead
  211.         of just writing it out.  (\} means }.)  This is done in addition to,
  212.         not instead of, normal output.  So you can use both -[...] and -{...}
  213.         at once with different formats.  The output is done first, the
  214.         command last.  Use of -O is recommended if you don't use -[...].  If
  215.         you want the files processed in sorted order, make sure to use either
  216.         -H or -L, or the columnar sorting feature will mess it up.  You can
  217.         use -[\+] to suppress all output and just run commands.
  218.  
  219. You can give several option letters after one dash, like "Dr -chs foo".  The
  220. case of the letters doesn't matter.  You can't combine option letters with
  221. format strings after one dash, though, and you can't (or at least shouldn't)
  222. put other options after a -P.  Each option affects those files and
  223. directories that come after it on the command line, except that any options
  224. at the end, after the last filename, act as if they were entered at the
  225. beginning.  Example:  "dr foo -s bar" lists directory foo without showing
  226. sizes, and directory bar with sizes shown.  If a directory name begins with a
  227. dash, put quotes around so that it isn't taken as options.  If you give an
  228. option twice, the second one cancels the first.  This means that if you make
  229. an alias like "alias list dr -lc []", you can make it sort alphabetically by
  230. saying "list -c".  Or, you can show directory foo with sizes, and directory
  231. bar without sizes, with the command "Dr -s foo -s bar".  (Note: since options
  232. at the end act like they are at the beginning, "Dr -s directory -s" will show
  233. the directory without the -s option!)
  234.  
  235. Some examples of using format strings:  to mark the files in directory foo as
  236. having been last updated yesterday, use
  237.  
  238.     Dr -o -{setdate "\p" yesterday} foo
  239.  
  240. To rename all xxxxxxx.BAK files in directory foo to directory bar, use
  241.  
  242.     Dr -o -{rename "\p" as "bar/\f"} foo/#?.BAK
  243.  
  244. To type out the contents of all files in foo with a header for each one, use
  245.  
  246.     Dr -[\n  **** File \p -=>] -{type "\p"} foo
  247.  
  248. You can execute more than one command for each file by putting \n in between
  249. them.  But the complete text after all substitutions are made must be less
  250. than 256 characters long or Dr cannot execute it.  If this happens it will
  251. write out a warning message and continue, and return 5 ("Warn") when it
  252. exits.  If one of the commands returns a DOS error code it will stop,
  253. returning 10 ("Error"), and the DOS error code will be that which caused it
  254. to fail (like 205 for "object not found" or whatever).
  255.  
  256. Some programs never set a DOS error code but indicate failure purely by their
  257. return value.  But Dr cannot tell what the return code is, because it uses
  258. the DOS Execute function.  To work around this, I am including a tiny program
  259. called R2E, which returns as its error code the value which the previous
  260. program gave as its return code.  You would use it by adding "\n r2e" to the
  261. end of your -{...} format command.  For instance, the rx program for running
  262. rexx scripts never sets a dos error code.  You would use R2E on it like this:
  263. Dr -{rx whatever \n r2e} foo.  Then if rx returned nonzero, r2e would
  264. cause Dr to stop at that point.  Or if your command is "type \p", and you
  265. want Dr to stop if you stop Type with a control-C, you would use
  266. Dr -{type \p\n r2e} foo, because when Type is control-C'ed it returns 5 but
  267. no error code.  For programs which don't react to control-C at all ... if you
  268. want to stop Dr, just keep banging control-C and sooner or later the signal
  269. will be heard by Dr instead of by the program being run.
  270.  
  271. To make the -{...} option work most efficiently, there are certain steps you
  272. should take.  One is this:  If you are using AmigaDOS 1.3, make sure you are
  273. using version 1.3.2 of SetPatch, not 1.3.0!  If you are using 1.2, get 1.3.2!
  274. Otherwise any program that uses the Execute function will reload C:Run from
  275. disk every time it's called.  With 1.3.2 or newer AmigaDOS you can avoid that
  276. by making C:Run resident.  Do this even if you don't use AmigaShell and don't
  277. make anything else resident.  But it helps if you DO use AmigaShell (make
  278. L:ShellSeg resident as "CLI") and make resident if possible whatever commands
  279. you are executing.  Make R2E resident if you ever use it; it's very small.
  280. If you don't use AmigaShell, copy the commands you are executing into ramdisk
  281. and run them from there.
  282.  
  283. You can put a number after R2E to give it a "fail level".  Return values
  284. below this number from the previous program will be returned as zero.  Like,
  285. R2E 10 will report no error if the previous program returns 5, but will if it
  286. returns 10.  The default "fail level" is 1.
  287.  
  288. Neat trick:  With Dr you can turn Lharc into a hard disk backup utility!
  289.  
  290.     Dr > Tempfile -orfip~a -{protect "\p" +a} disk:"
  291.  
  292. This will write a list of all the files in disk: that have been altered since
  293. the last backup into Tempfile, and simultaneously mark all those files as
  294. archived.  Then give the command
  295.  
  296.     Lharc -x -iTempfile a Vol:ArchiveName
  297.  
  298. and it will archive all the files named in Tempfile into Vol:ArchiveName.LZH.
  299.  
  300. You can continue Dr's command line onto multiple lines with a plus sign at
  301. the end of the line.  It considers this newline to be just like a space.
  302.  
  303. When you combine -R with a pattern, the complete contents of those outermost
  304. subdirectories whose names match the pattern will be shown.  If you combine
  305. -R with -D or -F, all subdirectories will be listed, with only the directory
  306. or file contents of each, according to the option, shown.
  307.  
  308. If you give more than one directory/pattern in the command line, each one's
  309. listing will be preceded by the name you gave, written like this:
  310.                               -- name --
  311. unless you use -O or -[...] in which case the different listings will not be
  312. separated.  If you give no directory or pattern, it lists the current
  313. directory, of course.  Or you can specify the current directory as empty
  314. quotes: "".
  315.  
  316. Note that the usage totals given at the end of a -S, -L, or -U output count
  317. only the files and dirs actually listed.  If some of the files are marked as
  318. having icons, then the blocks used by those .info files are not counted (they
  319. are in the case of -U).  Likewise things excluded by a pattern or -D or -F. 
  320. But the total count of blocks used by all files and directories is given in
  321. parentheses.  If you want complete totals for everything, use the -I option
  322. (if you're using -L and not -U) and don't use -D or -F or a pattern.  Note
  323. that it does not actually count all the blocks in each file, it just guesses
  324. from the file's length.  This is to avoid unnecessary disk access to read
  325. file extension blocks.  There are occasionally files that are bigger than
  326. they look; fake files made to contain bad tracks are often like this.
  327.  
  328. There is another version of Dr which is called Dr-S here.  It is smaller and
  329. slower (and eats less ram as it runs) because it uses regular ExNext instead
  330. of FastExNext.  To make it, compile dr.c with SMALLSLOW defined, and don't
  331. link with fastex.o; with make, just say "make s".  (Use "make d" for the
  332. regular version.)  Dr-S is actually faster in some cases when AddBuffers is
  333. of some use, e.g. if you list the same dir twice on the slow file system.  It
  334. is about 5k bytes smaller than the regular Dr.  Some users might prefer it,
  335. especially those who don't use floppy disks very much.
  336.  
  337. I did not give it a BCPL style argument template for reasons of size.  Almost
  338. 19k is plenty for a resident command.  (That's sure a lot bigger than Dir or
  339. List, but it's smaller than both together, and it pretty much replaces both.
  340. It also replaces du (with the -ru options) and Donald Kindred's rls (with
  341. options -orf) and the SPAT and DPAT scripts -- see the replacement versions
  342. of those files distributed with Dr.)  Maybe I should have used arp.library
  343. ... would use less memory *IF* you would routinely have that library loaded
  344. anyway.  I did make sure that quoted quotes are done with *" instead of
  345. Manx's default "", and that quotes make -options be treated as directory
  346. names.
  347.  
  348.  
  349. Some other features I might add someday:
  350.  
  351.     -G:  Show file's timestamp as age; days and hh:mm:ss before present.
  352.  
  353.     Some option to select whether "Today" etc. is used with -L?
  354.  
  355.     Handle patterns in the middles of paths, like foo/#?/src/#?.c
  356.  
  357.     Some way to cause a pattern at the end of the path to apply to files in
  358.         all subdirectories scanned.  That is, directorypath/?#?.(c|o) would
  359.         now be essentially also equivalent to directorypath/#?/?#?.(c|o) and
  360.         directorypath/#?/#?/?#?.(c|o), etc.  Maybe a pattern that ends with
  361.         :: would act this way.  This would implicitly use -R descent.
  362.  
  363.     Make -P able to make a mask of several bits.
  364.  
  365.     I should make it able to output each filename as it scans it, with no
  366.         sorting, like List.  Especially with the -O and -{...} options.  This
  367.         would disable .info hiding and flexible column width.  Use of
  368.         asynchronous disk IO may be worthwhile with this.
  369.  
  370.     More flexible formatting options.
  371.  
  372.     Separate version for Dos 1.2?
  373.  
  374.     Translate it all into assembly??
  375.  
  376. The Amiga is now the fourth system I have written a directory lister for.
  377. First was TOPS-20 (one that showed only files that you are the owner of),
  378. next Kaypro II (fast, 2K long, sorted, showed size), third 4.2 BSD Un*#%$!x
  379. (like ls -ls but faster because don't look up group names, just indicate
  380. whether your group).  So this one is like the crowning achievement of a great
  381. career in directory lister writing.  There is now almost no use at all for
  382. any other directory lister, except maybe if you actually find Dir's
  383. interactive mode to be of any use.  My original goal was just to produce an
  384. adequate alternative that left out .info files; my goal now is for Dr to be
  385. the best available.
  386.  
  387. Dr is in the public domain, written by
  388.  
  389.         bbses: try                      Paul Kienitz
  390.         Winners Circle 415-845-4812     6430 San Pablo ave.
  391.         Triple-A       415-222-9416     Oakland, CA  94608
  392.         FAUG           415-595-2479     USA
  393.  
  394. Feature suggestions and bug reports are appreciated.  I think it's pretty
  395. bulletproof, but there might be some file devices it can't read properly, one
  396. never knows.  Shareware incentive:  anyone who sends in a financial
  397. contribution will receive...  (drum roll) a nice thank-you note.  Which is
  398. more than I've gotten from some of our better known hackers.  If you want the
  399. source and didn't get it with the executable, you should be able to download
  400. it from any of those bbses.
  401.  
  402.  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  403.  
  404.               DIFFERENCES BETWEEN RELEASE 1.3 AND RELEASE 1.2:
  405.  
  406. Sorting of names and elimination of matched .info's greatly sped up.
  407.  
  408. Negative patterns with ~ in front added.
  409.  
  410. -{...} and -[...] formatting options added.  ForEvery no longer needed.
  411.  
  412. -A and -B options added.  -K option added.
  413.  
  414. FastExamine makes sure there is some EXTRA memory (20K) that it probably
  415. won't need, before it goes into high speed ram-hog mode.
  416.  
  417. Tested, but did not use, code to make FastExNext use asynchronous packets
  418. instead of ExNext() calls in the cases when it can't use its high speed code.
  419. I judge the speed improvement to be too small to justify the extra program
  420. size.  See makefile.
  421.  
  422.               DIFFERENCES BETWEEN 1.2 AND 1.1:
  423.  
  424. -P option was added.
  425.  
  426. My god!  I never noticed that the PatMatch functions I used were not
  427. reentrant!  I now use a modified patmatch.c instead of the original.
  428.  
  429. ForEvery (and Whichever just for the halibut) bundled with Dr.
  430.  
  431. 1.2 has been redone into ANSI C.  It's a bit smaller.
  432.  
  433. By request, the -s option now reports totals like the -l option.
  434.  
  435. The feature wherein recent files would show their dates as "Today" or
  436. "Wednesday" instead of the actual date has been removed.  To get it back,
  437. recompile dr.c with the symbol WEEEEK defined.  See makefile.
  438.  
  439. I wrote, but did not use, code to show directory names in boldface or against
  440. a black background or both instead of above a line of dashes.  See the
  441. makefile for how to compile this way.
  442.  
  443. Oops, the -- Name -- thing between different command line args' output was
  444. not eliminated by -o as documented, in older versions.
  445.  
  446.               DIFFERENCES BETWEEN 1.1 AND 1.0:
  447.  
  448. 1.0 gurued on many device drivers which did not support ETD_READ.  1.1 uses
  449. CMD_READ when ETD_READ fails, and the dumb mistake which caused a guru when
  450. it tried to report the error was fixed.  IF YOU SEE A COPY OF 1.0 GET RID OF
  451. IT, IT'S NO GOOD!  (This bug never showed up on my hardware.)
  452.  
  453. 1.1 pays attention to the MaxTransfer mount parameter, and if it is an
  454. integral fraction of the track size it pretends that this fraction is a
  455. "track", otherwise (gotta fix this someday) falls through to ExNext.
  456.  
  457. 1.0 did not check for adequate stack.  1.1 makes sure there is enough stack
  458. each time it descends another level with the -r option.
  459.  
  460. 1.0 had a small bug in reporting .info files with the -o option.
  461.